package com.wyb.controller;

import com.wyb.mapper.ArticleMapper;
import com.wyb.constant.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/deletearticle")
public class DeleteArticle {

    @Autowired
    private ArticleMapper articleMapper;
    @GetMapping
    @PreAuthorize("hasAnyAuthority('sys:cm:list')")
    public Result deleteArticle(@RequestParam int id){

        return articleMapper.deleteById(id)!= 0 ? new Result(200, "删除成功", null)
                                                : new Result(201, "删除失败", null);
    }
}
